package com.cn.stusy0015.demo0015;

import java.util.Arrays;

/**
 * @author lw
 * @ClassName Fruit.java
 * @Description
 * @createTime 2023年05月20日 16:36:00
 */
public class Fruit {
    String[] fruit=new String[5];
    public void addFruit(String str) {
        for (int i = 0; i <fruit.length ; i++) {
            if(fruit[i]==null){
                fruit[i] = str;
                break;
            }
        }
    }

    /**
     * 排序
     */
    public void sortFruit() {
        Arrays.sort(fruit);
    }

    public void show() {
        for (int i = 0; i < fruit.length; i++) {
            System.out.print(fruit[i]+"  ");
        }
    }
}
